# f = open('main.py', 'r')
# print(f.read())
# f.close()
#
# with open('main.py', 'r') as f:
#     print(f.read())

# f = open("demofile2.txt", "a")
# f.write("Now the file has more content!")
# f.close()
#
# # 追加后，打开并读取该文件：
# f = open("demofile2.txt", "r")
# print(f.read())

# # csv xlsx
# import pandas as pd
# df = pd.read_csv('aaa.csv')
# # DataFrame

# import pickle
# from sklearn.linear_model import LogisticRegression
# from sklearn.datasets import load_iris
# data = load_iris()
# X, y = data.data, data.target
# lr = LogisticRegression()
# lr.fit(X, y)
#
# f = open('lr.pkl', 'wb')
# pickle.dump(lr, f)

# import os
# for m in dir(os):
#     print(m)
#
# # print(os.environ)
# pa = os.path.join(r'C:\Users\Administrator', 'PycharmProjects', 'pythonProject')
# print(pa)

# import sys
# for m in dir(sys):
#     print(m)
#
# sys.exit(-10)

# from itertools import count
# for c in count(1):
#     print(c)

# from functools import lru_cache, reduce
#
#
# @lru_cache(maxsize=None)
# def fib(n):
#     if n < 2:
#         return n
#     return fib(n-1) + fib(n-2)
#
#
# print(fib(490))
#
# x0 = reduce(lambda x, y: x-y, [1, 2, 3, 4, 5])
# print(x0)

# # list comprehension
# d = [i for i in range(10)]
# print(d)
#
# s = sum([i for i in range(1, 1001)])
# print(s)
#
# from string import digits
# from random import choice
#
#
# def code1(n):
#     return ''.join([choice(digits) for _ in range(n)])
#
#
# d = {}
# for k in range(6):
#     d[f'user{k}'] = code1(8)
#
# print(d)

# pro = [[f'{j}*{i}={i*j}' for i in range(1, 10)] for j in range(1, 10)]
# for p in pro:
#     print('\t'.join(p))

# def plus1(x):
#     return x+1
#
# print(list(map(lambda x: x*x, list(range(10)))))

# # 1 1 2 3 5 8 13
# fibs = [1, 1]
# for k in range(100000):
#     a, b = fibs[-2], fibs[-1]
#     fibs.append(a+b)
#
# print(fibs[-1])

# # 1234321
# def hws(n):
#     return str(n) == str(n)[::-1]
#
# print(hws(23))
# print(hws(22))
# print(hws(1234321))
# print(hws(123432))

# 1 1
# 1 2 1 = 1 1 0 + 0 1 1
# 1 3 3 1 = 1 2 1 0 + 0 1 2 1

# tri2 = [1, 1]
# print(tri2)
# for _ in range(10):
#     left = [0] + tri2
#     right = tri2 + [0]
#     tri2 = [i + j for (i, j) in zip(left, right)]
#     print(tri2)

# 2021-11-12
import datetime

def days_of_years(s):
    y, m, d = s.split('-')
    y, m, d = list(map(int, [y, m, d]))
    date = datetime.datetime(y, m, d)
    date0 = datetime.datetime(y, 1, 1)
    print(date - date0)

print(days_of_years('2021-11-12'))
